Copyright: TDBLocateDialog Help Version 1.1
Citation: TDBLocateDialog Help Version 1.1


  TDBLocateDialog Component

Properties	Methods	Events

Description

The DBLocateDialog component is a direct descendent of TComponent.  It provides a Locate dialog box for database applications.  Users can implement the Locate dialog box to search for a value in a dataset. The locate operation locates and moves to the first record matching the value entered into the dialog box.

Display the Locate dialog box by calling the Execute method.

Select a dataset to search by setting the DataSource property to a TDataSource component that is linked to a TDataSet component (TTable,TQuery). To specify the Field on which to search, set the DataField property. The DataSource and DataField properties must be specified in order for the TDBLocateDialog to execute.

To set the default search options, use the LocateOptions property.  LocateOptions is a set of TLocateOption.  To prevent the user from selecting and changing the LocateOptions at run-time, set EnableLocateOptions to False (default is True).


Properties

Caption	LocateOptions

DataField	Mappings

DataSource	Name

EnableLocateOptions	NotifyOnFail

EnableFieldSelection	ShowValue

LastValue (run-time)	Tag


Events

OnFail

OnLocate


Methods

Execute


OnFail event for TDBLocateDialog
OnFail Event

Applies to TDBLocateDialog

OnFail occurs when the Locate dialog fails to find the value entered by the user.  For example, you can use this event to post a custom message to the user stating the locate operation has failed.


OnLocate event for TDBLocateDialog
OnLocate Event

Applies to TDBLocateDialog

OnLocate occurs when the Locate dialog successfully locates the value entered by the user.  For example, you can use this event to set the focus on a control that contains the DataField that was searched.


ShowValue property for TDBLocateDialog
ShowValue property

Applies to TDBLocateDialog

Declaration

property ShowValue: Boolean;

Description

The ShowValue determines whether the current DataField value is displayed in the value edit box of the Locate dialog box.


EnableFieldSelection property for TDBLocateDialog
EnableFieldSelection property

Applies to TDBLocateDialog

Declaration

property EnableFieldSelection: Boolean;

Description

The EnableFieldSelection determines if the Fields ComboBox in the Locate dialog box is enabled.  To prevent the user from selecting and changing DataFields at run-time, set the EnableFieldSelection property to False (default is True).


EnableLocateOptions property for TDBLocateDialog
EnableLocateOptions property

Applies to TDBLocateDialog

Declaration

property EnableLocateOptions: Boolean;

Description

The EnableLocateOptions determines if the LocateOptions in the Locate dialog box are enabled.  To prevent the user from selecting and changing LocateOptions at run-time, set the EnableFieldSelection property to False (default is True).


EnableOptions property for TDBLocateDialog
LocateOptions property

Applies to TDBLocateDialog

Declaration

property LocateOptions: TLocateOptions;

Description

LocateOptions determines the manner in which the locate operation is conducted.


LastValue property for TDBLocateDialog
LastValue property

Applies to TDBLocateDialog

Declaration

property LastValue: Variant;

Description

Run-time only.  LastValue contains the value of the last successful locate operation.  This value can be useful for implementing the FindNext method.


DataField property for TDBLocateDialog
DataField property

Applies to TDBLocateDialog

Declaration

property DataField: String;

Description

The DataField property identifies the default field on which the locate operation is to be performed.  The dataset the field is located in is specified in a data source component (TDataSource). The DataSource property of the TDBLocateDialog component specifies the data source component.  Note: The DataField property can be changed by the user at run-time.  Please see the Mappings

property for information on how to override this default behavior.


Mappings property for TDBLocateDialog
Mappings Property

Applies to TDBLocateDialog

Declaration

property Mappings: TStrings;

Description

The property Mappings has a dual purpose:

•	It allows the programmer to specify which DataFields are available to search.

•	It allows the programmer to specify user-friendly display names for DataFields.

Mappings should be in the form of DisplayName=DataField.  If Mappings are set, only those DataFields that have a corresponding DisplayName will appear in the Fields ComboBox on the Locate dialog box.  DisplayName may be any string (including spaces), but be sure not to insert any spaces between the equals sign and the DataField assignment.  Note:  If you receive a ‘Field Mapping does not exist’ error, check to see that the value of the DataField property is in the Mappings list.  Also, check your spelling.


NotifyOnFail property for TDBLocateDialog
NotifyOnFail property

Applies to TDBLocateDialog

Declaration

property NotifyOnFail: Boolean;

Description

Set the NotifyOnFail property to True if you would like a default ‘Unable to find Value:’ message to pop-up when a locate operation is unsuccessful.  Use the OnLocate and OnFail events to write your own event handlers.


Execute method for TDBLocateDialog
Execute method

Applies to TDBLocateDialog

Declaration

function Execute: Boolean;

Description

The Execute method displays the Locate dialog box in the application and returns True when the user closes the dialog box by choosing the OK button. If the user chooses Cancel or closes the dialog box by using the system menu, Execute returns False.

Example:

with TDBLocateDialog1 do begin

 	DataSource := DataSource1;

DataField := OrderNo;

Execute;

end;


Please Register TDBLocateDialog
Please Register

If you like the TDBLocateDialog component, or plan on using it, please purchase a registered copy of this software.

To register: Send a check or money order for $15, along with your name and e-mail address to:

Jason M. Packwood

9 Crested Iris Court

Gaithersburg, Maryland 20879

USA

Registered users will receive their registered version (no annoying message box reminders), and free updates to TDBLocateDialog component via e-mail.  If you really need your copy sent on diskette (and you live in the US), please send your postal address, and a note stating, “Please send TDBLocateDialog component on diskette!”

If you have any questions, comments, or suggestions, please e-mail me at jmpwood@ix.netcom.com


Disclaimer

No warranty is made or implied. Use this software at your own risk.


Version
TDBLocateDialog Version 1.1

This component was written and compiled in Delphi 2.0, and will therefore only work with Win95/WinNT.

Created September 1996.

Revised November 1996.